<%@ page import="swe.article.*"%>
<%@ page import="java.util.List"%>

<jsp:include page="layout/header.jsp" />

<% if (request.getParameter("search") != null) { %>
<h2>
	Suche nach "<%= request.getParameter("search")%>"
</h2>
<% } else if (request.getParameter("id") != null) { %>
<h2>
	Auktionen der Kategorie "<%= Category.getNameFromId(Integer.parseInt(request.getParameter("id"))) %>"
</h2>
<% } else {%>
<h2>Alle Autos</h2>
<% } %>

<div class="row-fluid">
	<ul class="thumbnails">
		<% 
        if(request.getAttribute("articleList") != null) {
        	List<Article> a = (List<Article>) request.getAttribute("articleList");
        	
        	for(int i=0; i<a.size(); i++)   {	
          		// Abgelaufenen nicht mehr anzeigen
         		if(a.get(i).isActive() == false) {
          			continue;
          		}	
      	%>
		<li class="span4">
			<div class="thumbnail">
				<div style="position:absolute; margin-left: 10px; margin-top: 5px">
				<% if(a.get(i).getIsAuction() == false) { %>
					<span class="label label-info">Sofort-Kaufen</span>
				<% } else {%>
					<span class="label label-info">Auktion</span>
				<% } %>
					
				</div>
				<img src="<%= a.get(i).getImage() %>" alt="" style="height: 240px">
				<div class="caption">
					<h3 class="pull-left"><%= a.get(i).getTitle() %></h3>

					<div class="clearfix"></div>

					<p style="height: 40px; overflow: hidden">
						<span class="label label-success"><%= a.get(i).getCategory().getName() %></span>
						<%=  a.get(i).getShortenedDescription() %>
					</p>
					<p class="pull-left">
						<a href="Article?action=view&amp;id=<%= a.get(i).getID() %>"
							class="btn btn-info">Details anzeigen</a>
					</p>
					<h3 class="pull-right" style="margin-top: 5px"><%= a.get(i).getStartprice() %>
						&euro;
					</h3>
					
					<div class="clearfix"></div>
				</div>
			</div>
		</li>
		<%
   				if((i+1) % 3 == 0) { %>
	</ul>
	<ul class="thumbnails">
		<%	
				}
          	} 
        }	
        %>


	</ul>
</div>



<jsp:include page="layout/footer.jsp" />
